<!DOCTYPE html>
<html>
<head>
    <meta charset='UTF-8'>
    <title>基本列表</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="root">
        <!-- 遍历数组 -->
        <h2>光与夜之恋</h2>
        <ul>
            <li v-for="(p ,index) in persons" :key="index">
                {{p.name}}-{{p.des}}
            </li>
        </ul>

        <!-- 遍历对象 -->
        <h2>个人信息</h2>
        <ul>
            <li v-for="(value,k) of person" :key="k">
                {{k}}:{{value}}
            </li>
        </ul>

        <!-- 遍历字符串 -->
        <h2>遍历字符串</h2>
        <ul>
            <li v-for="(char,index) of str" :key="index">
                {{cahr}}:{{index}}
            </li>
        </ul>
        
        <!-- 遍历指定次数 -->
        <h2>遍历字符串</h2>
        <ul>
            <li v-for="(number,index) of 5" :key="index">
                {{number}}:{{index}}
            </li>
        </ul>
    </div>
</body>
<!--   JS   -->
    <script>
        new Vue({
            el:'#root',
            data:{
                persons:[
                    {id:'001',name:'陆沉',des:'万甄总裁CEO'},
                    {id:'002',name:'查里苏',des:'财阀之子'},
                    {id:'003',name:'齐司礼',des:'狐狐老婆>_<'}
                ],
                person:{
                    name:'朝朝',
                    age:24,
                    des:'天才设计师'
                },
                str:'hello'
            }
        })
    </script>
</html>